package qldc.pm.tienan.action;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;

import javax.portlet.ActionRequest;
import javax.portlet.ActionResponse;
import javax.portlet.PortletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import qldc.pm.csdl.cd90.model.NoiThuongTru;
import qldc.pm.csdl.cd90.service.NoiThuongTruLocalServiceUtil;
import qldc.pm.tienan.dto.LichSuXoaAnTichDTO;
import qldc.pm.tienan.constants.PrintConverter;
import qldc.pm.tienan.constants.ThaoTacUndoRedoEnum;
import qldc.pm.tienan.constants.TienAnConstants;
import qldc.pm.tienan.model.DoiTuongTienAn;
import qldc.pm.tienan.model.LichSuXoaAnTich;
import qldc.pm.tienan.model.PhieuThongTinVeNguoiCoTienAn;
import qldc.pm.tienan.model.TEMP_DoiTuongTienAn;
import qldc.pm.tienan.model.TEMP_TienAn;
import qldc.pm.tienan.model.TienAn;
import qldc.pm.tienan.portlet.action.ReportAction;
import qldc.pm.tienan.service.DoiTuongTienAnLocalServiceUtil;
import qldc.pm.tienan.service.LichSuXoaAnTichLocalServiceUtil;
import qldc.pm.tienan.service.PhieuThongTinVeNguoiCoTienAnLocalServiceUtil;
import qldc.pm.tienan.service.TEMP_DoiTuongTienAnLocalServiceUtil;
import qldc.pm.tienan.service.TEMP_PhieuThongTinVeNguoiCoTienAnLocalServiceUtil;
import qldc.pm.tienan.service.TEMP_TienAnLocalServiceUtil;
import qldc.pm.tienan.service.TienAnLocalServiceUtil;

import com.liferay.portal.kernel.exception.PortalException;
import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.log.Log;
import com.liferay.portal.kernel.log.LogFactoryUtil;
import com.liferay.portal.kernel.servlet.ServletResponseUtil;
import com.liferay.portal.kernel.servlet.SessionErrors;
import com.liferay.portal.kernel.servlet.SessionMessages;
import com.liferay.portal.kernel.util.Constants;
import com.liferay.portal.kernel.util.ParamUtil;
import com.liferay.portal.kernel.util.Validator;
import com.liferay.portal.model.User;
import com.liferay.portal.util.PortalUtil;
import com.report.logic.Report;

public class QuanLyNguoiCoTienAn {
	private static Log _log = LogFactoryUtil.getLog(QuanLyNguoiCoTienAn.class);

	private static SimpleDateFormat DEFAULT_DATE_FORMAT = new SimpleDateFormat("dd/MM/yyyy");

	public void capNhatTienAn(ActionRequest actionRequest,
			ActionResponse actionResponse) throws IOException {
		SessionMessages.add(actionRequest, PortalUtil.getPortletId(actionRequest) + SessionMessages.KEY_SUFFIX_HIDE_DEFAULT_ERROR_MESSAGE);

		try {
			User user = PortalUtil.getUser(actionRequest);

			String soDinhDanhCaNhan = ParamUtil.getString(actionRequest, "soDinhDanhCaNhan");
			long tienAnId = ParamUtil.getLong(actionRequest, "tienAnId");

			String maSoHoSoTienAnTuToaAn = ParamUtil.getString(actionRequest, "maSoHoSoTienAnTuToaAn");
			String nguoiTrichLuc = ParamUtil.getString(actionRequest, "nguoiTrichLuc");
			String thamPhan = ParamUtil.getString(actionRequest, "thamPhan");
			String chuThich = ParamUtil.getString(actionRequest, "chuThich");
			String hoTenVoHoacChong = ParamUtil.getString(actionRequest, "hoTenVoHoacChong");
			String hoTenCha = ParamUtil.getString(actionRequest, "hoTenCha");
			String hoTenMe = ParamUtil.getString(actionRequest, "hoTenMe");
			String moTaTienAn = ParamUtil.getString(actionRequest, "moTaTienAn");
			String toaAnXuPhat = ParamUtil.getString(actionRequest, "toaAnXuPhat");
			String diaChiToaAnXuPhat = ParamUtil.getString(actionRequest, "diaChiToaAnXuPhat");
			Date ngayToaAn = ParamUtil.getDate(actionRequest, "ngayToaAn", DEFAULT_DATE_FORMAT);
			Date ngayPhamToi = ParamUtil.getDate(actionRequest, "ngayPhamToi", DEFAULT_DATE_FORMAT);
			String toiDanh = ParamUtil.getString(actionRequest, "toiDanh");
			String banAnSo = ParamUtil.getString(actionRequest, "banAnSo");
			String hinhPhatChinh = ParamUtil.getString(actionRequest, "hinhPhatChinh");
			String hinhPhatBoSung = ParamUtil.getString(actionRequest, "hinhPhatBoSung");
			String nghiaVuDanSu = ParamUtil.getString(actionRequest, "nghiaVuDanSu");
			String anPhi = ParamUtil.getString(actionRequest, "anPhi");
			NoiThuongTru noiThuongTru = NoiThuongTruLocalServiceUtil.findBySoDinhDanhCaNhan(soDinhDanhCaNhan);
			long noiThuongTruTinhId = noiThuongTru.getTinhId();
			long noiThuongTruQuanHuyenId = noiThuongTru.getQuanHuyenId();
			long noiThuongTruPhuongXaId = noiThuongTru.getPhuongXaId();
			String noiThuongTruDiaChi = noiThuongTru.getDiaChi();
			long noiTamTruTinhId = ParamUtil.getLong(actionRequest, "noiTamTruTinhId");
			long noiTamTruQuanHuyenId = ParamUtil.getLong(actionRequest, "noiTamTruQuanHuyenId");
			long noiTamTruPhuongXaId = ParamUtil.getLong(actionRequest, "noiTamTruPhuongXaId");
			String noiTamTruDiaChi = ParamUtil.getString(actionRequest, "noiTamTruDiaChi");
			String chuThichThongTinNoiLapPhieu = ParamUtil.getString(actionRequest, "chuThichThongTinNoiLapPhieu");

			String cmd = ParamUtil.getString(actionRequest, Constants.CMD);
			String undoRedo = ParamUtil.getString(actionRequest, "undoRedo");

			DoiTuongTienAn doiTuongTienAn = DoiTuongTienAnLocalServiceUtil.findBySoDinhDanhCaNhan(soDinhDanhCaNhan);

			String message = "";

			if(cmd.equals(Constants.ADD)) {
				if(Validator.isNull(doiTuongTienAn)) {
					doiTuongTienAn = DoiTuongTienAnLocalServiceUtil.addDoiTuongTienAn(user, soDinhDanhCaNhan);
				} else {
					doiTuongTienAn.setXoaAnTich(false);
					DoiTuongTienAnLocalServiceUtil.updateDoiTuongTienAn(doiTuongTienAn);
				}

				TienAn tienAn = TienAnLocalServiceUtil.addTienAn(user,
						doiTuongTienAn.getDoiTuongTienAnId(), banAnSo,
						toaAnXuPhat, diaChiToaAnXuPhat, ngayToaAn, toiDanh,
						ngayPhamToi, false, chuThich, hinhPhatChinh,
						hinhPhatBoSung, nghiaVuDanSu, anPhi, moTaTienAn);

				PhieuThongTinVeNguoiCoTienAnLocalServiceUtil
						.addPhieu(tienAn.getTienAnId(), user.getUserId(), user.getScreenName(), maSoHoSoTienAnTuToaAn, nguoiTrichLuc,
								thamPhan,
								soDinhDanhCaNhan, chuThichThongTinNoiLapPhieu,
								hoTenVoHoacChong,
								hoTenCha,hoTenMe,noiThuongTruTinhId,
								noiThuongTruQuanHuyenId, noiThuongTruPhuongXaId,
								noiThuongTruDiaChi, noiTamTruTinhId,
								noiTamTruQuanHuyenId, noiTamTruPhuongXaId,
								noiTamTruDiaChi);

				message = "thao-tac-thuc-hien-thanh-cong";
				removeAllTempDataOfCurrentUser(user.getUserId());
			} else if(cmd.equals(Constants.EDIT)) {
				TienAn tienAn = TienAnLocalServiceUtil.findByTienAnId(tienAnId);
				PhieuThongTinVeNguoiCoTienAn phieuThongTinVeNguoiCoTienAn = PhieuThongTinVeNguoiCoTienAnLocalServiceUtil.findByTienAnId(tienAnId);

				if (Validator.isNull(undoRedo)) {
					saveTienAnHoacDoiTuongTienAnForRedoKhiXoaHoacSua(tienAn, doiTuongTienAn, phieuThongTinVeNguoiCoTienAn,Constants.EDIT,ThaoTacUndoRedoEnum.UNDO.getKey());
				} else if(undoRedo.equals(ThaoTacUndoRedoEnum.UNDO.getKey())) {
					saveTienAnHoacDoiTuongTienAnForRedoKhiXoaHoacSua(tienAn, doiTuongTienAn, phieuThongTinVeNguoiCoTienAn,Constants.EDIT,ThaoTacUndoRedoEnum.REDO.getKey());
				} else {
					removeAllTempDataOfCurrentUser(tienAn.getUserId());
				}

				TienAnLocalServiceUtil.updateTienAn(tienAnId, user,
						doiTuongTienAn.getDoiTuongTienAnId(), banAnSo,
						toaAnXuPhat, diaChiToaAnXuPhat, ngayToaAn, toiDanh,
						ngayPhamToi, false, chuThich, hinhPhatChinh,
						hinhPhatBoSung, nghiaVuDanSu, anPhi, moTaTienAn);

				if(Validator.isNotNull(phieuThongTinVeNguoiCoTienAn)) {
					PhieuThongTinVeNguoiCoTienAnLocalServiceUtil.updatePhieu(
							phieuThongTinVeNguoiCoTienAn
									.getPhieuThongTinVeNguoiCoTienAnId(),
							tienAnId, user.getUserId(), user.getScreenName(),
							maSoHoSoTienAnTuToaAn, nguoiTrichLuc, thamPhan,
							soDinhDanhCaNhan, chuThichThongTinNoiLapPhieu,
							hoTenVoHoacChong, hoTenCha, hoTenMe,
							noiThuongTruTinhId, noiThuongTruQuanHuyenId,
							noiThuongTruPhuongXaId, noiThuongTruDiaChi,
							noiTamTruTinhId, noiTamTruQuanHuyenId,
							noiTamTruPhuongXaId, noiTamTruDiaChi);
				}

				message = "thao-tac-thuc-hien-thanh-cong";
			}

			SessionMessages.add(actionRequest, message);
		} catch (Exception e) {
			_log.warn(e);
			SessionErrors.add(actionRequest, "thao-tac-thuc-hien-khong-thanh-cong");
		}

		String redirect = ParamUtil.getString(actionRequest, "redirect");
		actionResponse.sendRedirect(redirect);
	}

	public void kyDuyetDanhSachXoaAnTich(ActionRequest actionRequest,
			ActionResponse actionResponse) throws SystemException, PortalException, IOException {
		SessionMessages.add(actionRequest, PortalUtil.getPortletId(actionRequest) + SessionMessages.KEY_SUFFIX_HIDE_DEFAULT_ERROR_MESSAGE);

		try {
			User user = PortalUtil.getUser(actionRequest);

			if (Validator.isNotNull(user)) {
				String cmd = ParamUtil.getString(actionRequest, "cmd");
				 if (cmd.equals(TienAnConstants.KY_DUYET_HO_SO_XOA)) {
					String lichSuXoaAnTichIds  = ParamUtil.getString(actionRequest, "lichSuXoaAnTichIds");
					removeAllTempDataOfCurrentUser(user.getUserId());
					String[] arrIds = lichSuXoaAnTichIds.split(",");
					for (String id : arrIds){
						long lichSuXoaAnTichId = Validator.isNotNull(id) ? Long.parseLong(id):0;
						if (lichSuXoaAnTichId > 0) {
							LichSuXoaAnTichLocalServiceUtil.thucHienXoaAnTich(lichSuXoaAnTichId, user);
						}
					}
				}

				SessionMessages.add(actionRequest, "ky-duyet-danh-sach-xoa-an-tich-thanh-cong");
			} else {
				SessionErrors.add(actionRequest, "vui-long-dang-nhap");
			}
		} catch (Exception e) {
			_log.warn(e);
			SessionErrors.add(actionRequest, "thao-tac-khong-thanh-cong");
		}

		String redirect = ParamUtil.getString(actionRequest, "redirect");
		actionResponse.sendRedirect(redirect);
	}

	public void xoaAnTich(ActionRequest actionRequest,
			ActionResponse actionResponse) throws SystemException, PortalException, IOException {
		SessionMessages.add(actionRequest, PortalUtil.getPortletId(actionRequest) + SessionMessages.KEY_SUFFIX_HIDE_DEFAULT_ERROR_MESSAGE);

		try {
			User user = PortalUtil.getUser(actionRequest);

			if (Validator.isNotNull(user)) {
				String cmd = ParamUtil.getString(actionRequest, "cmd");
				if (cmd.equals(TienAnConstants.LUU)) {
					LichSuXoaAnTichDTO dto = getParam(actionRequest);
					LichSuXoaAnTichLocalServiceUtil.addHoSoXoaAnTich(dto, user.getUserId());
					SessionMessages.add(actionRequest, "tao-ho-so-xoa-an-tich-thanh-cong");
				} else if (cmd.equals(TienAnConstants.KY_DUYET_HO_SO_XOA)) {
					long lichSuXoaAnTichId = ParamUtil.getLong(actionRequest, "lichSuXoaAnTichId");
					removeAllTempDataOfCurrentUser(user.getUserId());
					LichSuXoaAnTichLocalServiceUtil.thucHienXoaAnTich(lichSuXoaAnTichId, user);
					SessionMessages.add(actionRequest, "ky-duyet-xoa-an-tich-thanh-cong");
				} else {
					//print
					long lichSuXoaAnTichId = ParamUtil.getLong(actionRequest, "lichSuXoaAnTichId");
					LichSuXoaAnTich ls = LichSuXoaAnTichLocalServiceUtil.fetchLichSuXoaAnTich(lichSuXoaAnTichId);
					LichSuXoaAnTichDTO dto = PrintConverter.convertLichSuXoaAnTichToDto(ls);
					inLichSuXoaAnTich(dto, actionRequest, actionResponse);
				}
			} else {
				SessionErrors.add(actionRequest, "vui-long-dang-nhap");
			}
		} catch (Exception e) {
			_log.warn(e);
			SessionErrors.add(actionRequest, "thao-tac-khong-thanh-cong");
		}

		String redirect = ParamUtil.getString(actionRequest, "redirect");
		actionResponse.sendRedirect(redirect);
	}

	public void xoaYeuCauXoaAnTich(ActionRequest actionRequest, ActionResponse actionResponse) throws IOException {
		SessionMessages.add(actionRequest, PortalUtil.getPortletId(actionRequest) + SessionMessages.KEY_SUFFIX_HIDE_DEFAULT_ERROR_MESSAGE);

		User user;
		try {
			user = PortalUtil.getUser(actionRequest);

			if(Validator.isNotNull(user)) {
				long lichSuXoaAnTichId = ParamUtil.getLong(actionRequest, "lichSuXoaAnTichId");
				LichSuXoaAnTich ls = LichSuXoaAnTichLocalServiceUtil.fetchLichSuXoaAnTich(lichSuXoaAnTichId);
				LichSuXoaAnTichLocalServiceUtil.deleteLichSuXoaAnTich(ls);

				SessionMessages.add(actionRequest, "xoa-ho-so-thanh-cong");
			} else {
				SessionErrors.add(actionRequest, "vui-long-dang-nhap");
			}
		} catch (Exception e) {
			_log.warn(e);
			SessionErrors.add(actionRequest, "xoa-ho-so-khong-thanh-cong");
		}

		String redirect = ParamUtil.getString(actionRequest, "redirect");
		actionResponse.sendRedirect(redirect);
	}

	public void xoaTienAn(ActionRequest actionRequest, ActionResponse actionResponse) throws IOException {
		SessionMessages.add(actionRequest, PortalUtil.getPortletId(actionRequest) + SessionMessages.KEY_SUFFIX_HIDE_DEFAULT_ERROR_MESSAGE);

		try {
			User user = PortalUtil.getUser(actionRequest);

			String undoRedo = ParamUtil.getString(actionRequest, "undoRedo");
			long tienAnId = ParamUtil.getLong(actionRequest, "tienAnId");

			TienAnLocalServiceUtil.xoaTienAn(tienAnId, undoRedo, Constants.DELETE, user);

			SessionMessages.add(actionRequest, "xoa-tien-an-thanh-cong");
		} catch (Exception e) {
			_log.warn(e);
			SessionErrors.add(actionRequest, "thao-tac-khong-thanh-cong");
		}

		String redirect = ParamUtil.getString(actionRequest, "redirect");
		actionResponse.sendRedirect(redirect);
	}

	private void inLichSuXoaAnTich(LichSuXoaAnTichDTO dto, ActionRequest request, ActionResponse response) throws IOException{
		HashMap<String, Object> data = ReportAction.createReportQuanLyLichSuXoaAnTich(dto);
		PortletContext pc = request.getPortletSession().getPortletContext();
		String reportFileName = TienAnConstants.LICH_SU_XOA_AN_TICH;
		String reportFilePath = pc
				.getRealPath(TienAnConstants.REPORT_TEMPLATE_FOLDER + "/"
						+ reportFileName + ".jrxml");

		File file = Report.createReport(data, Report.DOC_TYPE, reportFilePath,
				reportFileName);
		if (Validator.isNotNull(file)) {
			InputStream in = new FileInputStream(file);

			HttpServletRequest httpServletRequest = PortalUtil
					.getHttpServletRequest(request);
			HttpServletResponse httpServletResponse = PortalUtil
					.getHttpServletResponse(response);
			ServletResponseUtil.sendFile(httpServletRequest,
					httpServletResponse, reportFileName + "."
							+ Report.DOC_TYPE, in, Report.DOC_STREAM_TYPE);
		}

	}

	private LichSuXoaAnTichDTO getParam(ActionRequest actionRequest) {
		LichSuXoaAnTichDTO result = new LichSuXoaAnTichDTO();

		long tienAnId = ParamUtil.getLong(actionRequest, "tienAnId");
		if (tienAnId > 0 ){
			TienAn ts;
			try {
				ts = TienAnLocalServiceUtil.fetchTienAn(tienAnId);
				result.setBanAnSo(ts.getBanAnSo());
				result.setToaAn(ts.getToaAnXuPhat());
				result.setNgayToaAn(ts.getNgayToaAn());
				result.setTienAnId(tienAnId);

				String diaChi = "";

				PhieuThongTinVeNguoiCoTienAn phieu = PhieuThongTinVeNguoiCoTienAnLocalServiceUtil.findByTienAnId(ts.getTienAnId());
					if (Validator.isNotNull(phieu)){
						diaChi = Validator.isNotNull(phieu.getNoiThuongTruDiaChi()) ? phieu.getNoiThuongTruDiaChi() : phieu.getNoiTamTruDiaChi();
						result.setDiaChi(diaChi);
					}

			} catch (SystemException e) {
				System.out.println("Khong tim thay tien an "+e.getMessage());
			}
		}

		long lichSuXoaAnTichId = ParamUtil.getLong(actionRequest, "lichSuXoaAnTichId",0L);
		result.setLichSuXoaAnTichId(lichSuXoaAnTichId);

		String hoVaTenDoiTuongTienAn = ParamUtil.getString(actionRequest, "hoVaTenDoiTuongTienAn");
		result.setHoVaTenDoiTuongTienAn(hoVaTenDoiTuongTienAn);
		Date ngayYeuCauXoaAnTich = ParamUtil.getDate(actionRequest, "ngayYeuCauXoaAnTich", DEFAULT_DATE_FORMAT);
		result.setNgayYeuCauXoaAnTich(ngayYeuCauXoaAnTich);

		String nguoiYeuCauXoaAnTich = ParamUtil.getString(actionRequest, "nguoiYeuCauXoaAnTich");
		result.setNguoiYeuCauXoaAnTich(nguoiYeuCauXoaAnTich);

		String maHoSoXoaAnTich = ParamUtil.getString(actionRequest, "maHoSoXoaAnTich");
		result.setMaHoSoXoaAnTich(maHoSoXoaAnTich);

		String coQuanThiHanhAn = ParamUtil.getString(actionRequest, "coQuanThiHanhAn");
		result.setCoQuanThiHanhAn(coQuanThiHanhAn);
		String kinhGui = ParamUtil.getString(actionRequest, "kinhGui");
		result.setKinhGui(kinhGui);
		String hinhPhat = ParamUtil.getString(actionRequest, "hinhPhat");
		result.setHinhPhat(hinhPhat);
		String soQuyetDinhThiHanhAn = ParamUtil.getString(actionRequest, "soQuyetDinhThiHanhAn");
		result.setSoQuyetDinhThiHanhAn(soQuyetDinhThiHanhAn);
		Date ngayQuyetDinhThiHanhAn = ParamUtil.getDate(actionRequest, "ngayQuyetDinhThiHanhAn", DEFAULT_DATE_FORMAT);
		result.setNgayQuyetDinhThiHanhAn(ngayQuyetDinhThiHanhAn);

		return result;
	}

	private void removeAllTempDataOfCurrentUser(long userId) throws SystemException{
		TEMP_DoiTuongTienAn doiTuongTienAnTemp = TEMP_DoiTuongTienAnLocalServiceUtil.findTempDoiTuongTienAnMoiNhatByUserId(userId);
		if (Validator.isNotNull(doiTuongTienAnTemp)){
			TEMP_PhieuThongTinVeNguoiCoTienAnLocalServiceUtil.xoaAllTempPhieuByDoiTuongTienAnId(doiTuongTienAnTemp.getDoiTuongTienAnId());;
			TEMP_TienAnLocalServiceUtil.xoaAllTempTienAn(doiTuongTienAnTemp.getDoiTuongTienAnId());
			TEMP_DoiTuongTienAnLocalServiceUtil.deleteTEMP_DoiTuongTienAn(doiTuongTienAnTemp);
		}
	}

	private void saveTienAnHoacDoiTuongTienAnForRedoKhiXoaHoacSua(TienAn tienAn,
			DoiTuongTienAn doiTuongTienAn, PhieuThongTinVeNguoiCoTienAn phieu, String thaoTac, String undoRedo) throws SystemException {
		if (Validator.isNotNull(tienAn) && Validator.isNotNull(doiTuongTienAn) && Validator.isNotNull(phieu)) {
			TEMP_DoiTuongTienAn doiTuongTienAnTemp = TEMP_DoiTuongTienAnLocalServiceUtil.findBySoDinhDanhCaNhan(doiTuongTienAn.getSoDinhDanhCaNhan());
			if (Validator.isNull(doiTuongTienAnTemp)) {
				doiTuongTienAnTemp = TEMP_DoiTuongTienAnLocalServiceUtil.addTEMP_DoiTuongTienAn(doiTuongTienAn.getUserId(), doiTuongTienAn.getUserName(),doiTuongTienAn.getSoDinhDanhCaNhan(), doiTuongTienAn.getDoiTuongTienAnId());
			}
			//xoa het nhung tien an truoc do
			TEMP_PhieuThongTinVeNguoiCoTienAnLocalServiceUtil.xoaAllTempPhieuByDoiTuongTienAnId(doiTuongTienAnTemp.getDoiTuongTienAnId());
			TEMP_TienAnLocalServiceUtil.xoaAllTempTienAn(doiTuongTienAnTemp.getDoiTuongTienAnId());

			TEMP_TienAn temptienan = TEMP_TienAnLocalServiceUtil
					.addTEMP_TienAn(tienAn.getUserId(), tienAn.getUserName(),
							doiTuongTienAnTemp.getDoiTuongTienAnId(),
							tienAn.getBanAnSo(), tienAn.getToaAnXuPhat(), "",
							tienAn.getNgayToaAn(), tienAn.getToiDanh(),
							tienAn.getNgayPhamToi(), tienAn.getXoaAnTich(),
							tienAn.getChuThich(), tienAn.getHinhPhatChinh(),
							tienAn.getHinhPhatBoSung(),
							tienAn.getNghiaVuDanSu(), tienAn.getAnPhi(),
							tienAn.getMoTaTienAn(), undoRedo, thaoTac,
							tienAn.getTienAnId());
			TEMP_PhieuThongTinVeNguoiCoTienAnLocalServiceUtil.addTEMPPhieu(
					temptienan.getTienAnId(), temptienan.getUserId(),
					temptienan.getUserName(), phieu.getMaSoHoSoTienAnTuToaAn(),
					phieu.getNguoiTrichLuc(), phieu.getThamPhan(),
					phieu.getSoDinhDanhCaNhan(), phieu.getChuThich(),
					phieu.getNoiTamTruDiaChi(), phieu.getHoTenVoHoacChong(),
					phieu.getHoTenCha(), phieu.getHoTenMe(),
					phieu.getNoiThuongTruDiaChi());
		}
	}
}
